package game;

public class GameMap {
	private int[][] map; //Map of the game as Integer matrix
	private int width, height;
	
	/**
	 * @param map - map of the game
	 */
	public GameMap(int width, int height){
		this.width = width;
		this.height = height;
		int[][] map = new int[width][height];
		this.map = map;
	}
	
	/**
	 * @return - returns the current map
	 */
	public int[][] getMap(){
		return this.map;
	}
	
	/**
	 * @return - returns the map width
	 */
	public int getWidth(){
		return this.width;
	}
	
	/**
	 * @return - returns the map height
	 */
	public int getHeight(){
		return this.height;
	}
	
	/**
	 * @param newMap - the new map
	 */
	public void setMap(int[][] newMap){
		this.map = newMap;
	}
	
	/**
	 * Sets a given point (number) on the map at the given (x,y)
	 * @param x - the x coordinate
	 * @param y - the y coordinate
	 * @param point - the number to put at the given coordinates (usually 0 or 1)
	 */
	public void setPointOnMap(int x, int y, int point){
		if(x > 0 && x < width && y > 0 && y < height){
			map[x][y] = point;
		}
	}
	
	/**
	 * checks if the map has a collision point at the given (x,y)
	 * @param x - the x coordinate
	 * @param y - the y coordinate
	 * @return - if map has a collision point at (x,y)
	 */
	public boolean hasPointAtLocation(int x, int y){
		if(map[x][y] == 1){
			return true;
		}
		return false;
	}
	
	/**
	 * clears the map
	 */
	public void clearMap(){
		int[][] clearMap = new int[width][height];
		this.setMap(clearMap);
	}
}
